<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no">
    <meta content="yes" name="apple-touch-fullscreen"/>
    <title>团购商品列表</title>
    <link rel="stylesheet" href="/static/css/base.css?v={$staticVersion}"/>
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/swiper-3.3.1.min.css" />
    <link rel="stylesheet" href="/static/css/groupbuying.css?v={$staticVersion}"/>
    <style>
    .dropload-down{text-align: center;padding-top:10px;}
    .back-top {
        width: 40px;
        height: 40px;
        background: url(/static/images/img/top.png) no-repeat 0 0;
        background-size: 100% 100%;
        display: none;
        position: fixed;
        right: 10px;
        bottom: 10px;
    }</style>
</head>
<body>
   <img class="banner" src="/static/images/img/tgimg.jpg">
   <a class="guarantee db" href="grouponApprove"><img src="/static/images/img/sb.jpg"></a>
   <nav class="sort-nav">
       <a {if $sort=='1'}class="on"{/if} data-sort=1 onclick="location.href='grouponList?sort=1'">综合排序</a>
       <a {if $sort=='2'}class="on"{/if} data-sort=2 onclick="location.href='grouponList?sort=2'">价格由低到高</a>
       <a {if $sort=='3'}class="on"{/if} data-sort=3 onclick="location.href='grouponList?sort=3'">价格由高到低</a>
       <a {if $sort=='4'}class="on"{/if} data-sort=4 onclick="location.href='grouponList?sort=4'">上架时间</a>
   </nav>
   <ul class="goods-list" id="content">
     <div class="lists"></div>
   <script id="template" type="text/html">
    <% for(var i=0;i<list.length;i++){ %>
       <li>
            <a href="groupondetail?flashId=<%=list[i].id%>">
            <%if(list[i].is_featured==1){%>
            <i class="today"></i>
            <%}%>
            <img class="shop-img" src="<%=list[i].image%>"> 
            <h4 class="omit"><%=list[i].title%></h4>
            <p class="time" data-endtime="<%=list[i].end_time%>" data-prefix="<%=list[i].button.status_msg%>">
                
            </p>
            <span class="red">￥<%=list[i].low_price%></span>
            起
            <small>￥<%=list[i].cost_price%></small>

            <div class="btn-box">
                <span class=<%=list[i].button.buy2_class%>><%=list[i].button.buy2%></span><br>
                <%=list[i].num_msg%>
            </div>
            </a>
       </li>
    <% } %>
    </script> 
   </ul>

   <div class="back-top _back-top"></div>

   <script src="/static/js/show/zepto.min.js?v={$staticVersion}"></script>
<script src="/static/js/show/template-native.js?v={$staticVersion}"></script>
<script src="/static/js/show/dropload.min.js?v={$staticVersion}"></script>
<script src="/static/js/show/zepto.scroll.js?v={$staticVersion}"></script>
<script src="/static/js/show/gear.js?v={$staticVersion}"></script>
<script>
    $(function(){
    // 页数
    var page = 0;
    function getUrlParam(name,defaultValue) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return defaultValue; //返回参数值
        }

     var isload = false;
    // dropload
    $('#content').dropload({
        scrollArea : window,
        domDown : {
             
        },
        loadDownFn : function(me){
            if(isload){
                return;
            }
            page++;
            isload=true;
            $.ajax({
                type: 'GET',
                url: '/ajax/GrouponList?page='+page+'&sort='+getUrlParam('sort',1),
                dataType: 'json',
                success: function(data){
                    var arrLen = data.list.length;
                    if(arrLen > 0){
                        $('.lists').append(template('template',{'list':data.list}));
                    }else{
                        me.lock();
                        me.noData();
                    }
                    if(!data.isNext){
                        me.noData();
                    }
                    me.resetload();
                    isload=false;
                },
                error: function(xhr, type){
                    me.noData();
                    me.resetload();
                    isload=false;
                }
            });
        }
    });
});

$(function(){
      if(typeof jw === "object") {
        jw.api('share_button', JSON.stringify({'status': true}));
        jw.api('set_share_info', JSON.stringify({
          'title': '虎扑跑步限时闪购',
          'description': '',
          'link_url':'{$staticHost}/show/grouponList',
        }));
      }
   });


starttimer({$current_time});

    $(window).scroll(function(){
        var sc=$(window).scrollTop();
        var rwidth=$(window).width()+$(document).scrollLeft();
        var rheight=$(window).height()+$(document).scrollTop();
        if(sc>0){
            $("._back-top").css("display","block");
            // $(".back-top").css("left",(rwidth-80)+"px");
            // $(".back-topp").css("top",(rheight-120)+"px");
        }else{
            $("._back-top").css("display","none");
        }
    });

    $('.back-top').on('click', function(e) {
        $.scrollTo({
            endY: 0,
            duration: 200,
        });
    });
</script>


</body>
{template 'show/web-gearfooter'}
<script type="text/javascript">
    if(typeof jw === "object" ) {
        jw.api('wv_setnav', JSON.stringify({
            "title": '',
            "nav": getNav([$shopcart,1])
        }), '')
    }
</script>